﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace HTComics.Data
{
    public class HTCUser
    {
        public static DataTable Login(string userName, string password)
        {
            return Common.GetDataTable("SP_LOGIN @Login='" + userName + "',@Password='" + password + "'");
        }

        public static DataTable GetUserByEmail(string email)
        {
            return Common.GetDataTable("SP_GET_USER_BY_EMAIL @Email='" + email + "'");
        }

        public static DataTable Signup(string firstName, string lastName, string userName, string password, string email)
        {
            return Common.GetDataTable("SP_CREATE_USER @FirstName='" + firstName + "', @LastName='" + lastName + "', @Login='" + userName + "', @Password='" + password + "', @Email='" + email + "'");
        }

        public static void CreateFeedback(string name, string phone, string email, string query)
        {
            string sql = "SP_CREATE_FEEDBACK ";
            sql += "@Name = '" + name + "'";

            if (!string.IsNullOrEmpty(phone))
                sql += "@Phone = '" + phone + "'";
            else
                sql += "@Phone = 'null'";

            sql += "@Email = '" + email + "'";
            sql += "@Query = '" + query + "'";

            Common.GetDataSet(sql);
        }

    }
}
